package com.hjt.controller;

import com.hjt.service.ClientService;
import com.hjt.service.dto.APIRequest;
import com.hjt.service.dto.APIResponse;
import com.hjt.service.param.UploadActionRecordParam;
import com.hjt.service.vo.ActionRecordListVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/gamehelper/client")
public class ClientController {
    @Resource
    ClientService clientService;

    @PostMapping("/upload/action/record")
    public APIResponse<Boolean> uploadActionRecord(@RequestBody @Validated APIRequest<UploadActionRecordParam> request) {
        clientService.uploadActionRecord(request.getContent());
        return APIResponse.<Boolean>build().content(true);
    }

    @PostMapping("/action/record/list")
    public APIResponse<ActionRecordListVO> actionRecordList() {
        return APIResponse.<ActionRecordListVO>build().content(clientService.actionRecordList());
    }
}
